﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Register.BLL;
using Register.Command;
using Register.DAL;
using Register.Model;
namespace RegisterWeb.Manager
{
    /// <summary>
    /// CheckLogin 的摘要说明
    /// </summary>
    public class CheckLogin : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string action=context.Request["action"];
            string userName=context.Request["name"];
            string password=MD5Provider.Hash(context.Request["pwd"]);
            if (action.Equals("checkAdmin")) {

                if (CheckLoginBLL.ExistsAdmin(userName, password))
                {
                    context.Response.Write("ok");
                }
                else {
                    context.Response.Write("no");
                }
               
            }
            else if (action.Equals("checkDocUser")) {
                if (CheckLoginBLL.ExistsDoctor(userName, password))
                {
                    context.Response.Write("ok");
                }
                else {
                    context.Response.Write("no");
                }
            
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}